﻿<%@ Import Namespace="BusinessLayer" %>
<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/ControlPanel.Master" AutoEventWireup="true" CodeBehind="News.aspx.cs" Inherits="intecnologia.Admin.News"  EnableEventValidation="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="AjaxScriptManager" runat="server">
    </asp:ScriptManager>
    
    <br />
    <center>
        <asp:UpdateProgress ID="UpdateProgress" runat="server" AssociatedUpdatePanelID="NewsUpdatePanel">
            <ProgressTemplate>
                <asp:Image ID="imgAjaxLoader" runat="server" ImageUrl="~/Admin/css/ajax-loader.gif" />
            </ProgressTemplate>
        </asp:UpdateProgress>
    
        <h2>Noticias</h2>
        <asp:Button ID="btnAddNews" runat="server" Text="Agregar una noticia nueva" 
            CssClass="boton" onclick="btnAddNews_Click" />
    </center>
    
    <br />


    <div class="mid_content" style="padding: 5px">
        
        <% if (NewsCount() > 0) %>
        <% { %>
                <asp:UpdatePanel ID="NewsUpdatePanel" runat="server">
                    <ContentTemplate>
                        <center>
                            <asp:DataList ID="dlNews" runat="server" AlternatingItemStyle-BackColor="#F8F8F8"
                                RepeatColumns="1" DataKeyField="NewsID" RepeatDirection="Horizontal" 
                                Width="100%" onitemcommand="dlNews_ItemCommand">
                                <ItemTemplate>
                                    
                                    <span class="span_title">Título:&nbsp;</span> 
                                    <span class="flt_l"><%# ((BusinessLayer.Model.Entities.News)Container.DataItem).Title %></span>
                                    <br />
                                    <span class="span_title">Fecha:&nbsp;</span>
                                    <span class="flt_l"><%# ((BusinessLayer.Model.Entities.News)Container.DataItem).Date %></span>
                                    <br />
                                    <div class="btn_flt_r">
                                        <asp:Button ID="btnEdit" runat="server" Text="Editar" CssClass="boton" CommandName="EditNews" UseSubmitBehavior="false" />
                                        <asp:Button ID="btnDelete" runat="server" Text="Eliminar" CssClass="boton" CommandName="DeleteNews" UseSubmitBehavior="false" />
                                    </div>
                                </ItemTemplate>
                            </asp:DataList>
                        </center>
                        
                    </ContentTemplate>            
                </asp:UpdatePanel> 
        </div>  
        <% } %>  
        <% else
           { %>
                <center><h3>Actualmente no existen noticias.</h3></center>
        <% } %>   
    
    <br />
</asp:Content>
